﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace BCVP.Net8.Repository.UnitOfWorks
{
    public interface IUnitOfWorkManage
    {
        SqlSugarScope GetDbClient();

        /// <summary>
        /// 获取DB，保证唯一性
        /// </summary>
        /// <returns></returns>
        int TranCount { get; }

        UnitOfWork CreateUnitOfWork();

        /// <summary>
        /// 开始事务的方法
        /// </summary>
        void BeginTran();
        void BeginTran(MethodInfo method);

        /// <summary>
        /// 提交事务的方法
        /// </summary>
        void CommitTran();
        void CommitTran(MethodInfo method);

        /// <summary>
        /// 回滚事务的方法
        /// </summary>
        void RollbackTran();
        void RollbackTran(MethodInfo method);
    }

}
